﻿<Page
    x:Class="CodeAbility.MonitorAndCommand.Windows8Monitor.SensorsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CodeAbility.MonitorAndCommand.Windows8Monitor"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting" 
    
    mc:Ignorable="d">

    <!-- http://eren.ws/2013/10/15/using-graphs-and-charts-in-windows-store-apps-boredom-challenge-day-11/ -->

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"></RowDefinition>
            <RowDefinition Height="2*"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="200"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <charting:Chart Grid.Row="0" Grid.Column="0" 
                        x:Name="TemperatureChart" 
                        HorizontalAlignment="Stretch" 
                        Margin="20, 5"
                        Width="Auto" Height="Auto">
            <charting:Chart.Axes>
                <charting:DateTimeAxis Orientation="X" ShowGridLines="false"/>
                <charting:LinearAxis x:Name="TemperatureAxis" Orientation="Y" ShowGridLines="false"/>
            </charting:Chart.Axes>            
            <charting:LineSeries Margin="0" 
                                 Title="Temperature"
                                 ItemsSource="{Binding TemperatureSerie}" 
                                 IndependentValuePath="Timestamp" 
                                 DependentValuePath="Value"/>            
        </charting:Chart>

        <TextBlock Grid.Row="0" Grid.Column="1" 
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   FontSize="36"
                   Text="{Binding FirstTemperatureData}"></TextBlock>

        <charting:Chart Grid.Row="1" Grid.Column="0" 
                        x:Name="HumidityChart" 
                        HorizontalAlignment="Stretch" 
                        Margin="20, 5"
                        Width="Auto" Height="Auto">
            <charting:Chart.Axes>
                <charting:DateTimeAxis Orientation="X" ShowGridLines="false"/>
                <charting:LinearAxis x:Name="HumidityAxis" Orientation="Y" ShowGridLines="false"/>
            </charting:Chart.Axes>
            <charting:LineSeries  Margin="0" 
                                 Title="Humidity"                                 
                                 ItemsSource="{Binding HumiditySerie}" 
                                 IndependentValuePath="Timestamp" 
                                 DependentValuePath="Value" />             
        </charting:Chart>

        <TextBlock Grid.Row="1" Grid.Column="1"
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   Text="{Binding FirstHumidityData}" FontSize="36"></TextBlock>

        <charting:Chart Grid.Row="2" Grid.Column="0" 
                        x:Name="PhotoVoltageChart" 
                        HorizontalAlignment="Stretch" 
                        Margin="20, 5"
                        Width="Auto" Height="Auto">
            <charting:Chart.Axes>
                <charting:DateTimeAxis Orientation="X" ShowGridLines="false"/>
                <charting:LinearAxis x:Name="VoltageAxis" Orientation="Y" ShowGridLines="false"/>
            </charting:Chart.Axes>
            <charting:LineSeries Margin="0"      
                                 Title="Voltage"
                                 ItemsSource="{Binding VoltageSerie}" 
                                 IndependentValuePath="Timestamp" 
                                 DependentValuePath="Value">                
                <!--<charting:LineSeries.DataPointStyle>
                    <Style TargetType="charting:LineDataPoint">
                        <Setter Property="Width" Value="17" />
                        <Setter Property="Height" Value="17" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="charting:LineDataPoint">
                                    <Ellipse Fill="Green" Stroke="Green" StrokeThickness="1" />
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </charting:LineSeries.DataPointStyle>-->
            </charting:LineSeries>
        </charting:Chart>

        <TextBlock Grid.Row="2" Grid.Column="1"
                   VerticalAlignment="Center" HorizontalAlignment="Center"
                   Text="{Binding FirstVoltageData}" FontSize="36"></TextBlock>

    </Grid>
</Page>